Today, most end user applications employ a graphical user interface (GUI) that simplifies the manner in which a user interacts with an application. Typical graphical user interface components include:
icons that trigger features of the application when selected by a user;
text fields that can be filled in by a user;
radio buttons presenting a choice of options, only one of which can be selected by a user;
combo boxes presenting a list of options, one of which can be selected by a user, as well as a field that can be filled in by a user;
check boxes presenting a choice of options, many of which can be simultaneously selected by a user;
lists presenting a list of options, one of which can be selected by a user; and
trees displaying hierarchical relationships of a set of objects.
In a typical GUI implementation, each GUI component generates GUI events to indicate changes in its value and/or the occurrence of user actions related to that GUI component. The type of GUI events generated depends on the type of the associated GUI component. For example, a text field component can generate focus events (when a user moves their mouse into the area on the screen corresponding to the text field) or action events (when a user hits the "enter" key or clicks a mouse button to enter a value into the field).
An application with a GUI is programmed so that any change in the value of a GUI component is reflected by a corresponding change in the value of an internal variable (or variables) mapped to that GUI component. In the prior art, the application code that accomplishes this mapping of GUI component values to internal variable values is crafted manually. For example, if an application includes a telNumber variable associated with a GUI telephone number text field, the application programmer would need to create a synchronization routine that:
1) detects GUI events associated with the GUI telephone number field;
2) accepts a new telephone number value entered in the GUI field;
3) converts it from the GUI representation (e.g., an array of ASCII values) to the internal representation (e.g., an integer); and
4) stores the resulting integer value in the telNumber variable.
The programmer would also need to write synchronization routines enabling any change in the value of an internal variable to be reflected in the value of the GUI component (or components) mapped to that internal variable. This need arises, e.g., when a search engine returns a result that needs to be displayed on a GUI screen.
Many object-oriented computer languages, such as the Java.TM. programming language (Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries), provide features that streamline some aspects of defining the interfaces between application and GUI code. For example, Java.TM. and other object-oriented languages support the use of business objects (BO), where a business object is an object used to transfer data between a client application (such as a database program) and a GUI screen for displaying/modifying the client data; typically the business objects are created by the client application. Typically, each business object includes a set of attributes associated with one type of entity. For example, in an electronic commerce application, business objects might exist for customer information (with attributes for last name, first name, address, phone number, etc.), order information (with attributes for item no., item color, quantity) and inventory information (with attributes for item no., item color, number available). These business objects conveniently package data for use by other objects; however, programmers using the Java.TM. programming language still need to write the routines that synchronize associated GUI component values and BO attribute values.
The Java.TM. programming language provides a class of objects, called listeners, that facilitates the coding of application GUIs. There are many different types of listeners, each of which is configured to detect a different type of GUI event. For example, in the case of a text field component, the application would need to employ focus and action listeners to detect focus and change events associated with that component. Moreover, each GUI component to be monitored by an application needs to have its own listener(s). For example, to interact with a customer GUI having two text field components (e.g., a customers last name and telephone number), an application would need respective pairs of focus and action listeners. Each event provides the name of the affected component, its old value and its new value.
Other types of listeners, called property change listeners, listen for change events generated by a BO whenever the values of one or more of its attributes change. Each change in a BO attribute leads to the generation of a respective change event that indicates the name and old and new values of the changed attribute. A BO can register several property change listeners. Whenever an attribute value changes, each of the listeners is notified with the change event and is responsible for identifying the changed attribute from the name included in the change event.
Applications configured to work with GUI and BO listeners receive notification of events detected by the listeners and synchronize the GUI components and BO attributes as appropriate. For example, an application that registered lastName and telNumber action listeners to a customer GUI would be notified whenever the GUI's last name and telephone number text field components were changed. The application could then call custom-coded synchronization routines to update corresponding lastName and telNumber attributes of a customer BO. In a similar vein, an application that registered property change listeners to lastName and telNumber attributes of the customer BO would receive notification of change events whenever the values of BO's last name and telephone number attributes were updated. The application would then call custom synchronization routines as a prelude to displaying the new values on the corresponding GUI components. Even with listeners, it is tedious to produce the application code needed for synchronization and the resulting code is likely to include errors.
Therefore, there is a need for a system and method for programming applications with GUIs that does not require the time-consuming and error-prone custom coding of GUI/internal variable synchronization routines, in general, and GUI/BO synchronization routines, in particular.